package main

import (
	"fmt"
	//"fmt"
	"strings"
)

func main() {
	for {
		rr := NewReceivedRabbitMQ("amqp://admin:admin@192.168.56.103:5672/", "SaveQQ_task_queue")
		myarr := rr.ReceiveDataTimeOut(120)
		if len(myarr) == 0 {
			continue
		}
		//deletesame远程调用
		QQlist := []string{}
		var word, email string
		for i := 0; i < len(myarr); i++ {
			msglist := strings.Split(myarr[i], "$#$")
			QQlist = append(QQlist, msglist[0])
			word = msglist[1]
			email = msglist[2]
		}
		newQQlist, _, _ := GetDeleteSameQQ(QQlist, email, word)
		newQQpath, _, _ := SaveFile(newQQlist, email, word)
		result := SendMail(newQQpath, word, email)
		if result == "ok" {
			fmt.Println("活干完了")
		} else {
			fmt.Println("活出错了")
		}

		//远程调用  写入文件
		//发送邮件

	}
}
